
    @if(Session::has('message'))
        <div class="alert alert-danger alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            <h4><i class="icon fa fa-check"></i> 提示！</h4>
            {{ Session::get('message') }}
        </div>
    @endif


    <div class="tabs-container">

        <ul class="nav nav-tabs">
            <li  class="{{ Active::query('status',1) }}"><a href="{{route('admin.shop.store.clerk.all',['status'=>1])}}"> 门店导购

            <li  class="{{ Active::query('status',0) }}"><a href="{{route('admin.shop.store.clerk.all',['status'=>0])}}"> 禁用
                </a></li>

        </ul>

        <div class="tab-content">

            <div id="tab-1" class="tab-pane active">

                   {!! Form::open( [ 'route' => ['admin.shop.store.clerk.all'], 'method' => 'get', 'id' => 'discount-form','class'=>'form-horizontal'] ) !!}
                    <div class="panel-body">
                    <div class="row">

                        <div class="col-md-6">
                            <div class="input-group col-md-6">
                                <input type="text" name="shop_name" value="{{request('shop_name')}}"   placeholder="门店名称"
                                       class=" form-control">
                            </div>
                        </div>

                        <div class="col-md-2">
                            <select class="form-control" name="title">
                                <option value="mobile" selected>
                                    导购手机
                                </option>
                                <option value="clerk_no" {{request('title')=='clerk_no'?"selected":''}}>
                                    导购工号
                                </option>
                                <option value="name" {{request('title')=='name'?"selected":''}}>
                                    导购姓名
                                </option>
                                <option value="email" {{request('title')=='email'?"selected":''}}>
                                    导购邮箱
                                </option>
                            </select>
                        </div>

                        <div class="col-md-4">
                            <input type="hidden" name="status" value="{{empty(request('status'))?0:1}}">
                            <div class="input-group">
                                <input type="text" name="value" value="{{request('value')}}"   placeholder=""
                                       class=" form-control"> <span
                                        class="input-group-btn">
                                        <button type="submit" class="btn btn-primary">查找</button></span></div>
                        </div>

                    </div>
                    {!! Form::close() !!}

                    <div class="hr-line-dashed"></div>

                    <div class="table-responsive">

                        <table class="table table-hover table-striped">
                            <tbody>
                            <!--tr-th start-->
                            <tr>
                                <th>ID</th>
                                <th>导购工号</th>
                                <th>姓名</th>
                                <th>邮箱</th>
                                <th>手机</th>
                                <th>门店</th>
                                {{--<th>门店导购二维码</th>--}}
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            <!--tr-th end-->
                            @if(count($lists)>0)
                                @foreach($lists as $item)
                                    <tr>
                                        <td>{{$item->id}}</td>
                                        <td>{{$item->clerk_no}}</td>
                                        <td>
                                            {{$item->name}}
                                        </td>

                                        <td>
                                            {{$item->email}}
                                        </td>
                                        <td>{{$item->mobile}}</td>
                                        <td>{{isset($item->shops->name)?$item->shops->name:''}}</td>


                                        <td>{{$item->created_at}}</td>
                                        <td>

                                            <a
                                                    class="btn btn-xs btn-primary"
                                                    href="{{route('admin.shop.clerk.edit',['shop_id'=>$item['shop_id'],'clerk_id'=>$item['id']])}}">
                                                <i data-toggle="tooltip" data-placement="top"
                                                   class="fa fa-pencil-square-o"
                                                   title="编辑"></i></a>

                                            <a>
                                                <i class="fa switch @if($item->status) fa-toggle-on @else fa-toggle-off @endif" title="切换状态" value = {{$item->status}} >
                                                    <input type="hidden" value={{$item->id}}>
                                                </i>
                                            </a>
                                            @if($item->is_clerk_owner)
                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <span class="badge">店长</span>
                                            @endif
                                        </td>
                                    </tr>

                                @endforeach
                            @endif

                            </tbody>

                        </table>

                        @if(count($lists)==0)
                            <div>
                                &nbsp;&nbsp;&nbsp;当前无数据
                            </div>
                         @else
                            <div class="pull-right">
                                {!! $lists->render() !!}
                            </div>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="modal" class="modal inmodal fade"></div>

    {!! Html::script(env("APP_URL").'/assets/backend/libs/jquery.zclip/jquery.zclip.js') !!}
    <script>
        $('.copyBtn').zclip({
            path: "{{url('assets/backend/libs/jquery.zclip/ZeroClipboard.swf')}}",
            copy: function(){
                return $(this).prev().val();
            }
        });
    </script>

    <script>
        $('.switch').on('click', function(){
            var value = $(this).attr('value');
            var modelId = $(this).children('input').attr('value');
            value = parseInt(value);
            modelId = parseInt(modelId);
            value = value ? 0 : 1;
            var that = $(this);
            $.post("{{route('admin.shop.clerk.status')}}",
                    {
                        status: value,
                        aid: modelId
                    },
                    function(res){
                        if(res.status){
                            that.toggleClass("fa-toggle-off , fa-toggle-on");
                            that.attr('value', value);
                            location.reload();
                        }else{
                            swal({
                                title: "操作失败",
                                text: "",
                                type: "error",
                                confirmButtonText: "确定"
                            },function () {
                                location.reload();
                            });
                        }
                    });

        })
    </script>






{{--@endsection--}}










